import Lockr from "lockr";
import { mapGetters } from "vuex"
export default {
    data() {
        return {
            // 分页
            currentPage: 1,
            pageSize: Lockr.get("crmPageSizes") || 15,
            pageSizes: [15, 30, 60, 100],
            total: 0,
            search: '',
            dateTime: [],
            selectionList: [],
        }
    },
    computed: {
        ...mapGetters(['crm'])
    },
    mounted(){
        console.log('mounted---')
        console.log(this.crm)
    },
    methods: {
        /**
        * 更改每页展示数量
        */
        handleSizeChange(val) {
            Lockr.set("crmPageSizes", val);
            this.pageSize = val;
            this.getList();
        },
        /**
         * 更改当前页数
         */
        handleCurrentChange(val) {
            this.currentPage = val;
            this.getList();
        },
        // 获取请求参数
        getsParams(params) {
            let new_params = JSON.parse(JSON.stringify(params))
            if (this.search) {
                new_params.search = this.search
            }
            if (this.dateTime && this.dateTime.length > 0) {
                new_params.startTime = this.dateTime[0];
                new_params.endTime = this.dateTime[1];
            }
            return new_params
        }
    }
}